<?php
/**
 * Enter description here ...
 * @author Micou13630
 */
class TreeType extends Bones implements IRenderable {
	
	protected $autoOpenRoot;
	protected $defaultIsFolder;
	protected $defaultNodeTitle;
	
	protected $modelType;
	
	protected $nameProperty;
	protected $titleProperty;
	protected $childrenProperty;
	protected $isFolderProperty;
	protected $openProperty;
	
	protected $root;
	protected $rootValue;
	protected $showRoot;
	
	protected $idField;
	protected $parentIdField;
	
	protected $data;
	
	protected $separateFolders;
	protected $sortFoldersBeforeLeaves;
	
	/**
	 * Constructeur
	 */
	public function TreeType($modelType) {
		parent::Bones();
		
		$this->data = array();
		$this->modelType = $modelType;
	}
	
	/**
	 * Defini la node root
	 * @param TreeNodeType $node
	 */
	public function defineRootNode(TreeNodeType $node) {
		$this->root = $node;
	}
	
	/**
	 * Ajoute une node
	 * @param TreeNodeType $node
	 */
	public function addNode(TreeNodeType $node) {
		$this->data[] = $node;
	}
		
	/**
	 * Implementation de object
	 * @see IRenderable::object()
	 */
	public function object() {
		return substr(get_class($this),0 ,(strlen(get_class($this)) - 4));
	}

	/**
	 * Implementation de properties
	 * @see IRenderable::properties()
	 */
	public function properties() {
		return parent::getProp($this);
	}
	
	/**
	 * Implementation de scLog
	 * @see IRenderable::scLog()
	 */
	public function scLog() {
		//
	}

	/**
	 * Implementation de render
	 * @see IScreen::render()
	 */
	public function render() {
		return "isc.".$this->object().".create({".$this->properties()."})";
	}
}
?>